﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace _7___URL
{
    class Program
    {
        static void ExtractURL(string input)
        {
            string pattern = @"(http://)?(www\.)?([\w\&\?=-]+\.)+[A-z]{2,4}((\/([\w\&\?=-]+)(\.[\w\&\?=-]+)*)*)?";
            foreach (var match in Regex.Matches(input, pattern))
            {
                Console.WriteLine(match);
            }
        }

        static void Main(string[] args)
        {
            string text = "Here are : some : @ ! url with http or without and some : abv.bg is this a url? " +
            "here is a valid url http://regexlib.mamaia.com/DisplayPatterns/kjasdhf.aspx?cattabindex=1&categoryId=2 " +
            "http://www.codeplex.com";
            ExtractURL(text);
        }
    }
}
